home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
vernon.zip
/
SINX.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1989-02-17
|
862b
|
41 lines
program SinofX;
{ This program calculates sin(x) using the Taylor's series
expansion:
i (2i + 1)
sin(x) = (-1) X
______________
(2i + 1) !
by continuing to calculate a new term until the value has
been calculated to within an accuracy of .0001 }
var X : real; I : integer; Sum : real;
{$I Power.pas}
{I Neg1.pas}
{I Xval.pas}
{I Fact.pas}
{I Term.pas}
begin
writeln('Enter a value for X to find the value sin(x):');
readln(x);
sum := 0;
I := 0;
while { accurracy still less than .0001 } do begin
Sum := Sum + Term(X,I);
I := I + 1
end;
writeln(' sin(x) = ', Sum:12:4)
end.